﻿package com.bizmlib.net
{
	import flash.events.EventDispatcher;
	import com.bizmlib.utils.Map;
	import com.bizmlib.events.ServerConnectorEvent;
	import com.bizmlib.net.IServerConnector;
	
	
	public class AbstractServerConnector extends EventDispatcher implements IServerConnector
	{
		private var serverURL:String;
	
	
		public function AbstractServerConnector()
		{
			init();
		}
	
	
		/**
		 * Does all the initialization stuff. Currently just calls an EventDispatcher's initialize method.
		 * Feel free to override but make sure you call superclass init method. If you do not, please, put all the requires code from this method to your implementation.
		 */
		private function init():void
		{
			//trace(this + ".init(" + arguments + ")");
		}
	
	
		/**
		 * Sets a value of the serverURL property
		 */
		public function setServerURL(value:String):void
		{
			serverURL = value;
		}
		/**
		 * Gets a value of the serverURL property.
		 */
		public function getServerURL():String
		{
			return serverURL;
		}
		/**
		 * Invokes on a server-side a specified action with the provided parameters.
		 */
		public function call(actionName:String, parameters:Map):void
		{
			//trace(this + ".call(" + arguments + ")");
		}
	
		/**
		 * Returns a string that describes an instance.
		 */
		override public function toString():String
		{
			return "[AbstractServerConnector	" + commonToString() + "]";
		}
		private function commonToString():String
		{
			return "serverURL:" + serverURL;
		}
	}
}